//
//  YEMTuiJianViewController.m
//  App_YueEnjoyMusic
//
//  Created by brother on 16/3/2.
//  Copyright © 2016年 brother. All rights reserved.
//

#define kMyViewFrameH self.view.frame.size.height
#define kMyViewFrameW self.view.frame.size.width


#import "YEMTuiJianViewController.h"

@interface YEMTuiJianViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,weak) UITableView *tJTableView;

@end

@implementation YEMTuiJianViewController

- (UITableView *)tJTableView {

    if (_tJTableView == nil) {
        UITableView *tempTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0,kMyViewFrameW ,kMyViewFrameH)];
        tempTableView.backgroundColor = [UIColor purpleColor];
        _tJTableView = tempTableView;
        tempTableView.delegate = self;
        tempTableView.dataSource = self;
        [self.view addSubview:tempTableView];
    }
    return _tJTableView;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    [self tJTableView];
    
    self.view.backgroundColor = [UIColor purpleColor];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    CGFloat numberRow = 0.0;
    if (indexPath.row == 0) {
        numberRow = kMyViewFrameW * 0.5;
    }else if (indexPath.row == 1) {
            
        numberRow = kMyViewFrameW * 0.45;
    }else if (indexPath.row == 2) {
            
        numberRow = kMyViewFrameW * 1.5;
    }else if (indexPath.row == 3) {
            
        numberRow = kMyViewFrameW * 1.5;
    }else if (indexPath.row == 4) {
            
        numberRow = kMyViewFrameW * 1.5;
    }else if (indexPath.row == 5) {
        
        numberRow = kMyViewFrameW * 1.5;
    }else {
            
        numberRow = kMyViewFrameW * 1.5;
    }
    return numberRow;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return 6;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
    
        if (indexPath.row == 0) {
            cell = [[[NSBundle mainBundle] loadNibNamed:@"SlideBarCell" owner:self options:nil]firstObject];
                                 NSLog(@"%f%f",cell.frame.size.width,cell.frame.size.height);
        }else if (indexPath.row == 1){
            
            cell = [[[NSBundle mainBundle] loadNibNamed:@"HYTwoGroupTableViewCell" owner:self options:nil]firstObject];
        }else if (indexPath.row == 2){
            
            cell = [[[NSBundle mainBundle] loadNibNamed:@"HYOneGroupCell" owner:self options:nil]firstObject];
        }else if (indexPath.row == 3){
            
            cell = [[[NSBundle mainBundle] loadNibNamed:@"HYOneGroupCell" owner:self options:nil]firstObject];
        }else if (indexPath.row == 4){
            cell = [[[NSBundle mainBundle] loadNibNamed:@"HYOneGroupCell" owner:self options:nil]firstObject];
            
        }else{
                                 
           cell = [[[NSBundle mainBundle] loadNibNamed:@"HYOneGroupCell" owner:self options:nil]firstObject];
      }
        
    }
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

//    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];// （这种是没有点击后的阴影效果)
    
    
    
//    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    
    cell.selected = NO; // （这种是点击的时候有效果，返回后效果消失）
}

@end
